from keras.utils import np_utils

X_train = X_train.reshape(num_train_images, image_height *
                          image_width).astype('float32')
X_test = X_test.reshape(num_test_images, image_height *
                        image_width).astype('float32')
print("X_train.shape: " + str(X_train.shape))
print("X_test.shape: " + str(X_test.shape))
print("y_train.shape: " + str(y_train.shape))
print("y_test.shape: " + str(y_test.shape))

print("y_train sample 5 value: " + str(y_train[5]))
print("y_train sample 2 value: " + str(y_train[2]))
  
X_train = X_train / 255   # values [0..1] improve results
X_test = X_test / 255
    
y_train = np_utils.to_categorical(y_train)
y_test = np_utils.to_categorical(y_test)
print("categorical y_train shape: " + str(y_train.shape))
print("categorical y_train sample 5 value: " + str(y_train[5]))
print("categorical y_train sample 2 value: " + str(y_train[2])) 
num_classes = y_test.shape[1]
print(num_classes)
